Replacement for HttpContext.Current.Request.ServerVariables["SERVER_NAME"] in Integrated Mode

Posted by Donniel on Stack Overflow See other posts from Stack Overflow or by Donniel
Published on 2009-10-20T08:13:04Z Indexed on 2010/05/18 4:51 UTC
Read the original article Hit count: 240

Filed under:
|

Hi,

Using HttpContext.Current.Request.ServerVariables["SERVER_NAME"] in integrated mode gives an error in IIS7 as per: http://mvolo.com/blogs/serverside/archive/2007/11/10/Integrated-mode-Request-is-not-available-in-this-context-in-Application%5F5F00%5FStart.aspx

Is there a replacement I can use in global.asax code for HttpContext.Current.Request.ServerVariables["SERVER_NAME"]?

This would be similar to using

String strPath = 
HttpContext.Current.Server.MapPath(HttpRuntime.AppDomainAppVirtualPath);

instead of

//String strPath = 
HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ServerVariables["PATH_INFO"]);

© Stack Overflow or respective owner

Related posts about iis7

Related posts about ASP.NET